package com.seaside.park.component;

import com.seaside.parkCommon.bean.ParkZone;
import com.seaside.parkCommon.mapper.ParkZoneMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.LinkedHashMap;
import java.util.List;

@Component
@Slf4j
public class ReadYZNo {

    @Autowired
    private ParkZoneMapper parkZoneMapper;

    //id和云智编码对应
    public static LinkedHashMap<Integer, ParkZone> codeProfile = new LinkedHashMap<>();

    public static LinkedHashMap<String, ParkZone> yzcodeProfile = new LinkedHashMap<>();

    @PostConstruct
    public void ReadYZNo() {
        log.info("1.系统初始化，读取编码表");
        List<ParkZone> parkZoneList = parkZoneMapper.selectList(null);
        for (ParkZone parkZone : parkZoneList) {
            codeProfile.put(parkZone.getZoneId(), parkZone);
            yzcodeProfile.put(parkZone.getZoneNo(),parkZone);
        }
    }
}
